<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/font_eye/iconfont.css">
    <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="css/login.css">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <form action="" method="get" class="form1">
            <label for="phone">手机号:</label>
            <input type="text" class="phone" placeholder="请输入手机号" id="phone"><br/>
            <p>
                <label for="pwd">&nbsp;&nbsp;&nbsp;密码:</label>
                <input type="text" class="password" placeholder="请输入密码" id="pwd">
                <i class="icon iconfont icon-eye1" id="eye"></i>
            </p>
            <button class="loginBtn">登录</button>
        </form>
    </div>
</body>
<script src="./js/jquery-3.4.1.min.js"></script>
<script>
    $(function() {
        $(".loginBtn").click(function(event) {
            event.preventDefault();
            $.ajax({
                type: "get",
                url: "http://localhost:8080/login",
                data: {
                    phone: $(".phone").val(),
                    password: $(".password").val()
                },
                success: function(res) {
                    location.href = "./index.html";
                },
                fail: function(err) {
                    console.log(err);
                }
            });
        })




        //眼睛切换效果
        let flag = true;
        $("#eye").click(function() {
            $(this)[0].className = `icon iconfont icon-eye${flag?'':'1'}`;
            flag = !flag;
        });
    })
</script>

</html>